#if defined xargs_rgb or defined xargs_bgr
#ifdef  xargs_rgb
#define xargs_name      xargs_rgb
template<class bits_t, uxx red_bits_v, uxx green_bits_v, uxx blue_bits_v>
xstruct(
    xtmpl(xargs_name, bits_t, red_bits_v, green_bits_v, blue_bits_v),
    xpric(m_blue ,  blue_bits_v , bits_t),
    xpric(m_green,  green_bits_v, bits_t),
    xpric(m_red  ,  red_bits_v  , bits_t),
    xwhos(inc::classify_t::graphic_rgbxx)
)
#else
#define xargs_name      xargs_bgr
template<class bits_t, uxx blue_bits_v, uxx green_bits_v, uxx red_bits_v>
xstruct(
    xtmpl(xargs_name, bits_t, blue_bits_v, green_bits_v, red_bits_v),
    xpric(m_red  ,  red_bits_v  , bits_t),
    xpric(m_green,  green_bits_v, bits_t),
    xpric(m_blue ,  blue_bits_v , bits_t),
    xwhos(inc::classify_t::graphic_bgrxx)
)
#endif
private:
    using final_t   = the_t;
    enum : u08{
        mask_blue   = (1 << blue_bits_v)  - 1,
        mask_green  = (1 << green_bits_v) - 1,
        mask_red    = (1 << red_bits_v)   - 1,

        shift_blue  = xbitsof(u08) - blue_bits_v,
        shift_green = xbitsof(u08) - green_bits_v,
        shift_red   = xbitsof(u08) - red_bits_v,
    };
public:
    // 一律按照 rgb888 处理
    xprops()
        xpubget_pubsetx(red, u08){
            xr{ return xthex.m_red << shift_red; }
            xw{ xthex.m_red = value >> shift_red; }
        };

        xpubget_pubsetx(green, u08){
            xr{ return xthex.m_green << shift_green; }
            xw{ xthex.m_green = value >> shift_green; }
        };

        xpubget_pubsetx(blue, u08){
            xr{ return xthex.m_blue << shift_blue; }
            xw{ xthex.m_blue = value >> shift_blue; }
        };

        xpubget_pubsetx(value, u32){
            xr{
                return u32(xthe.m_red << (16 + shift_red)) | u32(xthe.m_green) << (8 + shift_green) | u32(xthe.m_blue << shift_blue);
            }
            xw{
                xthex.m_blue    = (value >> (shift_blue      )) & mask_blue;
                xthex.m_green   = (value >> (shift_green +  8)) & mask_green;
                xthex.m_red     = (value >> (shift_red   + 16)) & mask_red;
            }
        };

        xpubgetx(gray08, inc::gray08){
            xr{
                auto value      = uxx((xthex->red + xthex->green + xthex->blue) / 3);
                return inc::gray08(value);
            }
        };

        xpubgetx(gray08x, inc::gray08){
            xr{
                // 系数乘以 1024(2^10)，所以整体需要右移 10bit
                auto value      = uxx(xthex->red * 306 + xthex->green * 601 + xthex->blue * 117) >> 10;
                return inc::gray08(value);
            }
        };
    $

    xprops_operator()
public:
#ifdef xargs_rgb
    constexpr xargs_name(u08 r, u08 g, u08 b) : 
        m_blue(b), m_green(g), m_red(r) {
    }
#else
    constexpr xargs_name(u08 r, u08 g, u08 b) : 
        m_red(r), m_green(g), m_blue(b) {
    }
#endif

    constexpr xargs_name() : xargs_name(0, 0, 0){}
$

#undef  xargs_name
#undef  xargs_rgb
#undef  xargs_bgr
#endif